const multer = require("@koa/multer");
const { UPLOAD_PATH } = require("../config/path");
console.log(multer);

const uploadAvatar = multer({
  // dest: UPLOAD_PATH,
  storage: multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, UPLOAD_PATH);
    },
    filename: function (req, file, cb) {
      cb(null, Date.now() + file.originalname);
    },
  }),
});
const handleAvatar = uploadAvatar.single("avatar");

module.exports = {
  handleAvatar,
};
